package com.dgcsxy.cat_eyes_movies.controller;

import com.dgcsxy.cat_eyes_movies.common.utils.ResponseResult;
import com.dgcsxy.cat_eyes_movies.entity.pojo.User;
import com.dgcsxy.cat_eyes_movies.entity.query.MoviesQuery;
import com.dgcsxy.cat_eyes_movies.service.MoviesService;
import org.springframework.web.bind.annotation.*;

/**
 * @Author rokies
 * @DATE 2022/6/16 16:41
 * @Version 1.0
 */
@RestController
@RequestMapping("/movies")
public class MoviesController {

    private final MoviesService moviesService;

    public MoviesController(MoviesService moviesService) {
        this.moviesService = moviesService;
    }

    @PostMapping("/search")
    public ResponseResult movieSearch(@RequestBody MoviesQuery moviesQuery){
        return moviesService.queryMoviesByName(moviesQuery.getMovieName());
    }

    @GetMapping("/page")
    public ResponseResult movieSearch(){
        return moviesService.queryMoviesByPage(1,8);
    }
}
